<?php require_once 'header.php';?>    
<!-- DataTables Responsive CSS -->
    <link href="sb2/vendor/datatables-responsive/dataTables.responsive.css" rel="stylesheet">

        <!-- Page Content -->
        <div id="page-wrapper">
            <div class="container-fluid">
                <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <?php echo XXF_LNAME?>
                        </div>
                        <!-- /.panel-heading -->
                        <div class="panel-body">
							<table width="100%" class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>班级名称</th>
                                        <th style="min-width:55px;">姓名</th>
                                        <th>电话</th>
                                        <th>单位</th>
                                        <th style="width:80px;">财务收费床位等级</th>
                                        <th>财务备注</th>
                                        <th style="width:80px;">招待所床位等级</th>
                                        <th>招待所房间号</th>
                                        <th>招待所备注</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                	<?php
                                	$i=0;
                                	foreach ($result as $row){$i++;
                                	?>
                                    <tr class="<?php echo $i%2==0?"even":"odd";?> gradeA" id='<?php echo $row['puid'];?>'>
                                        <td><?php echo $i;?></td>
                                        <td><?php echo $row['pname'];?></td>
                                        <td><span id="pu_<?php echo $row['puid'];?>"><?php echo $row['puname'];?></span></td>
                                    	<td><?php echo $row['mphone'];?></td>
                                        <td><?php echo $row['workunit'];?></td>
                                        <td><?php echo $row['flevel'];?></td>
                                        <td><?php echo $row['fbeizhu'];?></td>
                                        <td><span id="zl_<?php echo $row['puid'];?>"><?php echo $row['zlevel'];?></span></td>
                                        <td><span id="fn_<?php echo $row['puid'];?>"><?php echo $row['fangnum'];?></span></td>
                                        <td><span id="zb_<?php echo $row['puid'];?>"><?php echo $row['zbeizhu'];?></span></td>
                                        <td><input type="button" id="b" value="修改" onclick="upd(<?php echo $row['puid'];?>)"></td>
                                    </tr>
                                	<?php 
                                	}
                                	?>
                                </tbody>
                            </table><input id="ztime" name="x" value="<?php echo date("Y-m-d")?>" type="hidden">
                        </div>
                        <!-- /.panel-body -->
                    </div>
                    <!-- /.panel -->
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
             </div>
        </div>
        <!-- /#page-wrapper -->
  </div>
        <!-- DataTables JavaScript -->
<?php require_once 'bottom.php';?>
    <script src="sb2/vendor/datatables/js/jquery.dataTables.js"></script>
    <script src="sb2/vendor/datatables-plugins/dataTables.bootstrap.min.js"></script>
    <script src="sb2/vendor/datatables-responsive/dataTables.responsive.js"></script>
    <script>
    $(document).ready(function() {
		$('#dataTables-example').DataTable({
            responsive: true,
            "aaSorting": [[ 0, "desc" ]],
            "aLengthMenu": [ 200, 100, 50, 10 ]
        });
        
    });
	function upd(id){
		$.xconfirm($("#pu_"+id).text()+"<br><br>等级<select id='zlevel' name='x'><option "+(($("#zl_"+id).text()=="一类床位")?"selected":"")+">一类床位</option><option "+(($("#zl_"+id).text()=="二类床位")?"selected":"")+">二类床位</option><option "+(($("#zl_"+id).text()=="三类床位")?"selected":"")+">三类床位</option><select/><br><br>房号<input id='fangnum' name='x' value='"+($("#fn_"+id).text())+"'><br><br>备注<input id='zbeizhu' name='x' value='"+($("#zb_"+id).text())+"'>",
			function(tf){
				if(tf){
					$.xloading(1);
					$.xtodb("upd","peixunxueyuan",$("[name='x']"),id,function(data1){
						if(data1==0){
							$.xloading(0);
							$.xalert("处理失败,检查填写是否正确!");
						}else{
							alert("处理成功！");
							history.go(0);
						}
					}); 
				}
			});
	}
    </script>